
#include "cmatrixprod_ref.h"


void cmatrixprod_ref(int M, int N, int P, 
		 t_complex *A, 
		 t_complex *B, 
		 t_complex *C)


{
  int i,j,k;
  t_complex som;

  
  for(i=0;i<M;i++){
    for (j=0;j<N;j++){
      som=C[i*N+j];
      for (k=0;k<P;k++) {
	som.r = som.r + A[i*P+k].r*B[k*N+j].r-A[i*P+k].i*B[k*N+j].i;
	som.i = som.i + A[i*P+k].r*B[k*N+j].i+A[i*P+k].i*B[k*N+j].r;
      }
      C[i*N+j]=som;
    }
    
  }
}    
	
